<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
</head>
<body>

<script src="class.js"></script>

<script>
window.onload = function(){
	var ICar = new Interface('ICar', ['run', 'stop']);
	var IXxx = new Interface('IXxx', ['xxx']);
	
	$_package('MyApp.util',
		$_Class('Car',{
			$_extends: '',
			$_implements: 'ICar, IXxx',
			$_: function(p1, p2){
				//privates 
				var _var1 = '***';
				var _func1 = function(m){alert(m);};
				
				//public
				this.color = 'red';
				this.weight = '1000kg';
				this.xxx = function(){
					alert(this.weight + p1 + _var1 + p2);
				};
				this.run = function(){
					var clr = this.color + ':)';
					_func1(clr);
				};
				this.stop = function(){
					alert('stop');
				};
				this.getRestOil = function(){
					return Math.round(Math.random()*9999);
				}
			},
		}),
		$_Class('XialiCar',{
			$_extends: 'MyApp.util.Car',
			$_implements: 'ICar, IXxx',
			$_: function(xxx){
				//privates 
				var _var1 = '***';
				var _func1 = function(m){alert(m);};
				
				//public
				this.sayName = function(){
					alert('Xiali_' + xxx + '_' + this.getRestOil());
				};
				this.stop = function(){
					this.$_mOverride('stop');
					alert('stop again');
				};
			},
		})
	);
	
	var car = new MyApp.util.XialiCar('tom');
	car.stop();
	car.xxx();
	car.sayName();
};
</script>
</body>
</html>